<!--
 * @Author: liuyonghu
 * @Date: 2021-10-26 17:48:23
 * @LastEditTime: 2021-10-26 18:20:50
 * @LastEditors: liuyonghu
 * @Description: 
 * @FilePath: /demos/1.html
-->

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <style>
    .warpper {
      height: 100%;
      background: orange;
      color: white;
    }
  </style>
</head>



<body>
  <div id="app" style="width: 900px; height: 900px">


    <div v-for="it in [1,2,3,listItem]" :key="it">
      this is {{it}}
    </div>

    {{message}}
    <todo>
      <!-- <template slot-scope="props"> -->
      <!-- {{props.msg}} -->
      <!-- </template> -->
      <template v-slot:default>
        default --
      </template>
      <!-- <template v-slot:default="{msg}">
                default -- {{ msg }}
            </template> -->

      <template v-slot:msg1="{msg1}">
        <b> msg1 == {{ msg1 }}</b>
      </template>

      <!-- <template v-slot:msg1>
                <b> msg1 == </b>
            </template> -->

    </todo>

    <script type="text/x-template" id="my-template">
            <div>
                <div>
                    <slot :msg='msg'></slot>
              </div>
                <p>----</p>
                <div>
                    <slot name='msg1' :msg1='msg1'></slot>
                </div>
            </div>
        </script>

  </div>
  <!-- <script type="text/x-template" id="my-template">
        <div>
            <div>
                <slot :msg='msg'></slot>
          </div>
            <p>----</p>
            <div>
                <slot name='msg1' :msg1='msg1'></slot>
            </div>
        </div>
    </script> -->
  <script>
    window.onload = () => {
      Vue.component("todo", {
        template: '#my-template',
        // template: "<span><slot name='msg1' :msg1='msg1'></slot></span>",

        //                 template: `
        //     <div class="warpper">
        //         <div>
        //             <slot :msg='msg'></slot>
        //         </div>
        //         <p>----</p>
        //         <div>
        //             <slot name='msg1' :msg1='msg1'></slot>
        //         </div>
        //     </div>
        //    `,
        // template: "<span><slot :msg='msg'></slot></span>",
        //   "<span><slot :user='user'>{{ user.lastName }}</slot></span>",

        data() {
          return {
            msg1: " msg1 child component ",
            msg: " msg child component ",
          };
        },
      });

      var app = new Vue({
        el: "#app",
        data() {
          return {
            message: "123",
            user: { lastName: "666", firstName: "666" },
            //   slotProps:{ user: { lastName: "666",firstName: "666" }}
            listItem: 9
          };
        },
      });
    };
  </script>

  <script src="https://cdn.staticfile.org/vue/2.6.2/vue.min.js"></script>
</body>

</html>